fix(ui): keep titlebar presses from starting a text selection - #191
Merged
Conversation
A press on a window drag strip propagated to the window-level Markdown selection controller, which proxy-anchored a selection to the nearest message. Once start_window_move swallowed the mouse-up on macOS, the selection's auto-scroll loop kept scrolling the chat up and extending the selection for as long as the titlebar was held. Prevent the default on the drag area's left mouse-down: the controller already skips default-prevented presses outside Markdown hitboxes, and drag strips contain no Markdown. Covers the chat header, sidebar top strip, settings header and diff tab strip alike. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Holding the titlebar kept selecting chat content and scrolling the list upward (按住标题栏会不断选中正文内容并向上滚动).
A press on a
window_drag_areastrip propagated to the window-level Markdown selection controller, which proxy-anchored a selection to the nearest message view. On the first mouse move the controller saw the pointer above the list's top edge and started its 16ms auto-scroll task; meanwhilestart_window_move()entered the native macOS window drag, which swallows the mouse-up — soend_selectionnever ran and the scroll/select loop continued for as long as the titlebar was held.Fix
Call
window.prevent_default()in the drag area's left mouse-down handler (crates/ui/src/shell.rs). The selection controller already skips default-prevented presses that land outside Markdown hitboxes (window_selection.rs), and drag strips contain no Markdown — matching native titlebar behavior. Covers all four drag surfaces: chat header, sidebar top strip, settings header, diff tab strip.Testing
press_on_titlebar_drag_area_does_not_start_selection, with a sentinel assertion that a blank-space press still arms selection (guards against a vacuous pass). Verified it fails with the fix reverted.cargo test -p tcode-ui --lib: 230 passed. Clippy and fmt clean.🤖 Generated with Claude Code